# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=tree-sitter-go
pkgver=0.19.1_git20220530
_gitrev=aeb2f33b366fd78d5789ff104956ce23508b85db
pkgrel=1
pkgdesc="Go grammar for tree-sitter"
url="https://github.com/tree-sitter/tree-sitter-go"
license="MIT"
arch="all"
makedepends="tree-sitter-dev"
checkdepends="tree-sitter-cli"
install_if="tree-sitter-grammars"
source="https://github.com/tree-sitter/tree-sitter-go/archive/$_gitrev/tree-sitter-go-$_gitrev.tar.gz"
builddir="$srcdir/$pkgname-$_gitrev"

case "$CARCH" in
    s390x|riscv64) options="!check" ;; # blocked by tree-sitter-cli
    *) options="!check" ;; # tests fail on builders
esac

build() {
	abuild-tree-sitter build
}

check() {
	tree-sitter test
}

package() {
	DESTDIR="$pkgdir" abuild-tree-sitter install
}

sha512sums="
255c64cb28cee57862dd49f915a5e8520340eb95408c0e6af13afe584b6619571d0d2d5b0c6b5092b10052673c8c720ad45409227139772f6c2075c6e1501f1e  tree-sitter-go-aeb2f33b366fd78d5789ff104956ce23508b85db.tar.gz
"
